﻿using System.Text.Json.Serialization;

namespace Simple.Services;

/// <summary>
/// 登录信息
/// </summary>
public class LoginModel
{
    /// <summary>
    /// 账号
    /// </summary>
    [Required(ErrorMessage = "账号不能为空！")]
    public string Account { get; set; }

    /// <summary>
    /// 密码
    /// </summary>
    [Required(ErrorMessage = "密码不能为空！")]
    public string Password { get; set; }

    public LoginModel(string account, string password)
    {
        Account = account;
        Password = password;
    }
}

public class AppLoginModel
{
    /// <summary>
    /// 手机号
    /// </summary>
    [Required(ErrorMessage = "手机号不能为空！")]
    public string? Phone { get; set; }

    /// <summary>
    /// 密码
    /// </summary>
    [Required(ErrorMessage = "密码不能为空！")]
    public string? Password { get; set; }

    /// <summary>
    /// 登录类型
    /// </summary>
    [Required(ErrorMessage = "请选择需要登录的操作端！")]
    public int? LoginType { get; set; }

    /// <summary>
    ///  将选择的确认数据传过来
    /// </summary>
    public object? ConfirmData { get; set; }
}

/// <summary>
/// App登录返回信息
/// </summary>
public class AppLoginOutPutModel
{
    /// <summary>
    /// 登录类型
    /// </summary>
    [JsonConverter(typeof(JsonStringEnumConverter))]
    public LoginType LoginType { get; set; }
    /// <summary>
    /// 是否存在多个幼儿/园区
    /// </summary>
    public bool IsMultiple { get; set; }

    /// <summary>
    /// token(当IsMultiple=true时，token为空)
    /// </summary>
    public string? Token { get; set; }

    /// <summary>
    /// 确认列表（有多个数据时需要确认幼儿或园区）
    /// </summary>
    public object? ConfirmList { get; set; }

    /// <summary>
    /// 登录信息
    /// </summary>
    public LoginUserModel? UserInfo { get; set; }
}

public class PreSchoolModel
{
    /// <summary>
    /// 机构Id
    /// </summary>
    public Guid? OrgId { get; set; }
    /// <summary>
    /// 机构名称
    /// </summary>
    public string? OrgName { get; set; }

    /// <summary>
    /// 幼儿Id
    /// </summary>
    public Guid? ChildId { get; set; }

    /// <summary>
    /// 幼儿姓名
    /// </summary>
    public string? ChildName { get; set; }

    /// <summary>
    /// 家长Id
    /// </summary>
    public Guid? ParentId { get; set; }
    /// <summary>
    /// 家长姓名
    /// </summary>
    public string? ParentName { get; set; }

    /// <summary>
    /// 家长关系
    /// </summary>
    public int? Relationship { get; set; }

    /// <summary>
    /// 所在班级
    /// </summary>
    public string? ClassesId { get; set; }

    /// <summary>
    /// 所在班级
    /// </summary>
    public string? ClassesName { get; set; }

    /// <summary>
    /// 头像
    /// </summary>
    public string? Avatar { get; set; }
}

public class OrgConfirmModel
{
    /// <summary>
    /// 机构Id
    /// </summary>
    public Guid? OrgId { get; set; }
    /// <summary>
    /// 机构名称
    /// </summary>
    public string? OrgName { get; set; }
    /// <summary>
    /// 
    /// </summary>
    public Guid UserId { get; set; }

}

public class LoginUserModel
{
    /// <summary>
    /// 用户ID（当是园所端时是用户表ID，家长端时是家长ID）
    /// </summary>
    public Guid? UserId { get; set; }
    /// <summary>
    /// 账号
    /// </summary>
    public string? Account { get; set; }
    /// <summary>
    /// 姓名
    /// </summary>
    public string? UserName { get; set; }
    /// <summary>
    /// 性别
    /// </summary>
    public int? Sex { get; set; }
    /// <summary>
    /// 头像
    /// </summary>
    public string? Avatar { get; set; }
    /// <summary>
    /// 登录机构Id
    /// </summary>
    public Guid? OrgId { get; set; }
    /// <summary>
    /// 登录机构名称
    /// </summary>
    public string? OrgName { get; set; }
    /// <summary>
    /// 岗位Id
    /// </summary>
    public Guid? PostId { get; set; }
    /// <summary>
    /// 岗位
    /// </summary>
    public string? PostName { get; set; }

    // 当是家属端的时候登录信息包含以下
    /// <summary>
    /// 登录的宝宝Id
    /// </summary>
    public Guid? ChildId { get; set; }
    /// <summary>
    /// 登录的宝宝姓名
    /// </summary>
    public string? ChildName { get; set; }

    /// <summary>
    /// 登录的宝宝头像
    /// </summary>
    public string? ChildAvatar { get; set; }
    /// <summary>
    /// 与宝宝的关系
    /// </summary>
    public int? Relationship { get; set; }
    /// <summary>
    /// 登录的班级id
    /// </summary>
    public string? ClassesId { get; set; }
    /// <summary>
    /// 登录的班级名称
    /// </summary>
    public string? ClassesName { get; set; }

    /// <summary>
    /// 是否包含员工考勤UI显示（小程序端）
    /// </summary>
    public bool IncludeEmployeeAttendance { get; set; }
}
